Skip to content

Conversation

@Jaffe-
Copy link

@Jaffe- Jaffe- commented Mar 6, 2017

Hi, I don't know if you accept pull requests or not, but here's some additions to the driver if you're interested. :)

I'm using your driver in a project, and it works great. However it isn't easy to use from userspace since you have to call read() in order for the radio to go into listen mode. Instead of the radio only going into RX mode when a call to read() is active, it is useful to be able to set the radio in RX mode and do other things while the radio is receiving. This commit adds the possibility to put the radio in RX mode and have the driver's IRQ handler put things into a circular buffer when they are received. read() now only gets data from the buffer (or blocks if the buffer is empty).

I added the sysfs attribute "listen" (which takes '1' or '0') to put the driver in this autonomous mode. If the attribute is 0 then the driver should behave as it did before (only turning on RX when read() is called).

Support for O_NONBLOCK and poll/select is also added (useful if userspace wants to find out if there are any pending messages to be read). Perhaps signals should also be added to make it complete.

I'm not very experienced with driver development, so I'm not fully sure if things like locking is right. It seems to work very well though.

The driver now supports a listening mode, which is set by writing to
the sysfs attribute 'listen'. In this mode, the radio is constantly
in RX mode and stores incoming packets in a receive buffer.

When not in listening mode, the behavior is the same as before.

poll() is also implemented to be able to use select() to check for
new packets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant